home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 23
/
AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso
/
PublicDomain
/
Anwendungen
/
db3.6-beta-src
/
Pointers.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-12-11
|
4KB
|
196 lines
/* WaitPointer.c Two routines to block input on a window */
/* Will use a hires waitpointer on v39+ and a lo-res "clock" in pre v39 */
/* Currently only allows only one invocation at a time */
/* If a a function is called twice in a row, the 2:nd call will be ignored */
#include <exec/types.h>
#include <exec/libraries.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <intuition/pointerclass.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <graphics/gfx.h>
#include "Pointers.h"
extern struct IntuitionBase *IntuitionBase;
/* Data */
APTR Pointer = NULL;
UWORD __chip leftright_plOS20[] =
{
0x0000, 0x0000,
0x1860, 0x1860,
0x3870, 0x2850,
0x7FF8, 0x4FC8,
0xFFFC, 0x8004,
0x3030, 0x4FC8,
0x1020, 0x2850,
0x0000, 0x1860,
0x0000, 0x0000
};
UWORD __chip leftright_pl[][10] =
{
/* Plane 0 */ {
0x0C30,
0x1C38,
0x3C3C,
0x7FFE,
0xFFFF,
0x7FFE,
0x381C,
0x1818,
0x0810,
0x0000 },
/* Plane 1 */ {
0x0C30,
0x1428,
0x2424,
0x47E2,
0x8001,
0x8001,
0x47E2,
0x2424,
0x1428,
0x0C30 }
};
struct BitMap leftrightBitMap = {
2, /* UWORD BytesPerRow */
10, /* UWORD Rows */
0, /* UBYTE Flags */
2, /* UBYTE Depth */
0, /* UWORD pad */
{ (PLANEPTR)&leftright_pl[0], (PLANEPTR)&leftright_pl[1] } /* PLANEPTR Planes[8] */
};
UWORD __chip easymove_plOS20[] =
{
/* Plane 0,1 */
0x0000, 0x0000,
0xC000, 0x4000,
0x7000, 0xB000,
0x3C00, 0x4C00,
0x3F00, 0x4300,
0x1FC0, 0x20C0,
0x1FC0, 0x2000,
0x0F00, 0x1100,
0x0D80, 0x12AA,
0x04C0, 0x0955,
0x0460, 0x08A2,
0x0020, 0x0141,
0x0000, 0x0082,
0x0000, 0x0101,
0x0000, 0x00AA,
0x0000, 0x0155,
0x0000, 0x0000
};
UWORD __chip easymove_pl[][15] =
{
/* Plane 0 */ {
0xC000,
0x7000,
0x3C00,
0x3F00,
0x1FC0,
0x1FC0,
0x0F00,
0x0D80,
0x04C0,
0x0460,
0x0020,
0x0000,
0x0000,
0x0000,
0x0000 },
/* Plane 1 */ {
0x4000,
0xB000,
0x4C00,
0x4300,
0x20C0,
0x2000,
0x1100,
0x12AA,
0x0955,
0x08A2,
0x0141,
0x0082,
0x0101,
0x00AA,
0x0155 }
};
struct BitMap easymove_bm = {
2, /* UWORD BytesPerRow */
15, /* UWORD Rows */
0, /* UBYTE Flags */
2, /* UBYTE Depth */
0, /* UWORD pad */
{ (PLANEPTR)&easymove_pl[0], (PLANEPTR)&easymove_pl[1] } /* PLANEPTR Planes[8] */
};
void ChangePointer(struct Window *win, char pointertype)
{
if (Pointer) return;
if (IntuitionBase->LibNode.lib_Version >= 39) {
switch (pointertype) {
case LRPointer :
Pointer = NewObject(NULL, "pointerclass",
POINTERA_BitMap, &leftrightBitMap,
POINTERA_XOffset, -7,
POINTERA_YOffset, -4,
POINTERA_XResolution, POINTERXRESN_SCREENRES,
POINTERA_YResolution, POINTERYRESN_SCREENRESASPECT
);
break;
case MovePointer:
Pointer = NewObject(NULL, "pointerclass",
POINTERA_BitMap, &easymove_bm,
POINTERA_XOffset, 0,
POINTERA_YOffset, 0,
POINTERA_XResolution, POINTERXRESN_SCREENRES,
POINTERA_YResolution, POINTERYRESN_SCREENRESASPECT
);
break;
}
if (!Pointer) {
return;
}
SetWindowPointer(win, WA_Pointer, Pointer, TAG_DONE);
}
else {
switch (pointertype) {
case LRPointer :
SetPointer(win, leftright_plOS20, 7, 16, -8, -3);
break;
case MovePointer:
SetPointer(win, easymove_plOS20, 15, 16, -1, 0); // Note -1 not 0 for compatibility.
break;
}
}
}
void RestorePointer(struct Window *win)
{
if (IntuitionBase->LibNode.lib_Version >= 39) {
if (!Pointer) return;
SetWindowPointer(win, TAG_DONE);
DisposeObject(Pointer);
Pointer = NULL;
}
else ClearPointer(win);
}